'''
Created on 18.11.2009

@author: guest
'''
from google.appengine.ext import db

class Project(db.Model):
    creator = db.UserProperty() 
    createdAt = db.DateTimeProperty(auto_now_add=True) 
    name = db.StringProperty() 
    description = db.TextProperty() 
    
class Role(db.Model):
    name = db.StringProperty()
    project = db.ReferenceProperty(Project)
    canEditProject = db.BooleanProperty()
    canAssign =  db.BooleanProperty()
    canBeAssigned = db.BooleanProperty()

class Participant(db.Model):
    user = db.UserProperty()
    project = db.ReferenceProperty(Project)
    
class ParticipantRole(db.Model):
    participant = db.ReferenceProperty(Participant)
    role = db.ReferenceProperty(Role)
    
class Task(db.Model):
    index = db.IntegerProperty()
    name = db.StringProperty()
    description = db.TextProperty()
    createdAt = db.DateTimeProperty(auto_now_add=True)
    creator = db.UserProperty()
    project = db.ReferenceProperty(Project)
    assignedTo = db.ReferenceProperty(Participant)
    status = db.StringProperty()
    priority = db.IntegerProperty()
    
class Comment(db.Model):
    task = db.ReferenceProperty(Task)
    text = db.StringProperty(multiline=True)
    createdAt = db.DateTimeProperty(auto_now_add=True)
    creator = db.UserProperty()